layui.use(['element','layer'], function() {
    var layer=layui.layer;
    function messageLoad(){
        //动态菜单
        layui.jquery.ajax({
            url: "/friend/messageList",
            method: 'POST',
            success: function(res) {
                var html = "";
                if (res!=""){
                    for(var i = 0; i < res.length; i++) {
                        var strli ="";
                        strli+="<div class='ones'><div class=\"one\">"+res[i].userName+"<div><a onclick='agreeMessage("+res[i].id+");' id=\"agree\" href=\"javascript:;\"><font class=\"layui-icon\">&#xe61f;</font></a><a onclick='disagreeMessage("+res[i].id+");' id=\"disagree\" href=\"javascript:;\"><font style=\"margin-left: 20%;\" class=\"layui-icon\">&#xe616;</font></a></div></div></div>";
                        html = html + strli;
                    }
                }else {
                    html+="<div style=\"text-align: center;\">暂无好友申请</div>";
                }
                layui.jquery("#queryMessage").html(html);
                layui.element.init(); //一定初始化一次
            }
        });
    };
    window.setInterval(messageLoad, 100);
});